<template>
    <div class="home">
        <h2>{{$store.state.nickname }}</h2>
        <button @click="update()">修改</button>
        <ul>
          <li v-for="(item, index) in $store.getters.female" :key="index">
            {{item.name}}
          </li>
        </ul>
    </div>
</template>

<script>
/* eslint-disable */ // 忽略该行往下 eslint的错误

export default {
    name: "Home",
    computed: {
    },
    data() {
        return {
          count:1
        };
    },
    methods: {
      update() {
        //  commit 第一个参数跟的是 mutations 中得方法  第二个参数是值
        this.$store.commit('setnickname','ace')
      }
    },
    created() {
      // 兄弟组件传参
      this.$bus.$on('change', () => { 
        console.log(this.count);
       })
    },
};
</script>

<style scoped>
.home{
  border: 1px solid green;
  margin: 10px 0;
}
</style>
